package com.gzm.springcloud.service.impl;

import com.gzm.springcloud.dao.DeptDao;
import com.gzm.springcloud.pojo.Dept;
import com.gzm.springcloud.service.DeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @ClassName DeptServiceImpl
 * @Description:
 * @Author gzm
 * @Date 2020/11/23 10:48
 **/
@Service
public class DeptServiceImpl implements DeptService {
    @Autowired
    private DeptDao dao ;

    @Override
    @Transactional(rollbackFor = Exception.class)
    public boolean add(Dept dept)
    {
        return dao.addDept(dept);
    }

    @Override
    public Dept get(Long id)
    {
        return dao.findById(id);
    }

    @Override
    public List<Dept> list()
    {
        return dao.findAll();
    }

}
